import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:wallet_utils/color.dart';
///ButtonStyle 属性及颜色工具
class ButtonStyleUtils{
  static ButtonStyle buttonStyleF65247(){
    return ButtonStyle(
      elevation: MaterialStateProperty.all(0),
      shape:MaterialStateProperty.all(RoundedRectangleBorder(
        borderRadius: BorderRadius.circular(22)
      )),
      foregroundColor: MaterialStateProperty.resolveWith(
            (states) {
          if (states.contains(MaterialState.focused) &&
              !states.contains(MaterialState.pressed)) {
            //获取焦点时的颜色
            return ColorManager.colorD93C3A;
          } else if (states.contains(MaterialState.pressed)) {
            //按下时的颜色
            return ColorManager.colorD93C3A;
          }
          //默认状态使用灰色
          return ColorManager.colorD93C3A;
        },
      ),

      //背景颜色
      backgroundColor: MaterialStateProperty.resolveWith((states) {
        //设置按下时的背景颜色
        if (states.contains(MaterialState.pressed)) {
          return ColorManager.colorD93C3A;
        } else if (states.contains(MaterialState.disabled)) {
          return ColorManager.colorBCDAF8;
        }
        //默认不使用背景颜色
        return ColorManager.colorD93C3A;
      }),
      //设置水波纹颜色
      overlayColor: MaterialStateProperty.all(Colors.transparent),
    );
  }

  static ButtonStyle buttonStyleHXH(){
    return ButtonStyle(
      elevation: MaterialStateProperty.all(0),
      shape:MaterialStateProperty.all(RoundedRectangleBorder(
      )),
      foregroundColor: MaterialStateProperty.resolveWith(
            (states) {
          if (states.contains(MaterialState.focused) &&
              !states.contains(MaterialState.pressed)) {
            //获取焦点时的颜色
            return ColorManager.colorD93C3A;
          } else if (states.contains(MaterialState.pressed)) {
            //按下时的颜色
            return ColorManager.colorD93C3A;
          }
          //默认状态使用灰色
          return ColorManager.colorD93C3A;
        },
      ),

      //背景颜色
      backgroundColor: MaterialStateProperty.resolveWith((states) {
        //设置按下时的背景颜色
        if (states.contains(MaterialState.pressed)) {
          return ColorManager.color1D52FF;
        } else if (states.contains(MaterialState.disabled)) {
          return ColorManager.colorBCDAF8;
        }
        //默认不使用背景颜色
        return ColorManager.color1D52FF;
      }),
      //设置水波纹颜色
      overlayColor: MaterialStateProperty.all(Colors.transparent),
    );
  }

  // 主题色的按钮
  // 主题色和浅主题色
  static ButtonStyle getThemeColor({bool isActivated = true}) {
    return ButtonStyle(
      elevation: MaterialStateProperty.all(0),
      backgroundColor: MaterialStateProperty.all(isActivated ? ColorManager.colorF65247 : ColorManager.colorFBB9B5),
      overlayColor: MaterialStateProperty.all(Colors.transparent)
    );
  }

  //普通按钮，带边框
  static ButtonStyle buttonStyleNoOverLay({Color? sideColor,Color? bgColor}){
    return ButtonStyle(
      padding: MaterialStateProperty.all( const EdgeInsets.all(0)),
      elevation: MaterialStateProperty.all(0),
      side: MaterialStateProperty.all(BorderSide(
          color: sideColor??ColorManager.colorCCCCCC, width: 0.5.w)),
      backgroundColor:
      MaterialStateProperty.all(bgColor??ColorManager.colorFFFFFF),
      overlayColor: MaterialStateProperty.all(bgColor??ColorManager.colorFFFFFF),
    );
  }
}